package com.chen.lifepic.downloader;

import com.chen.lifepic.DataInfo.DataInfo;
import com.chen.lifepic.utils.APPCommonDef.PictureType;

public class HttpDownloadTask extends BaseTask {
	HttpDownloader _downloader = null;

	public HttpDownloadTask(DataInfo info, ITaskListener listener,
			PictureType type) {
		super(info, listener, type);
		_downloader = new HttpDownloader(_listener);
	}

	@Override
	public void start() {
		super.start();
		if (null == getMediaInfo())
			return;

		if (null != _listener)
			_listener.TaskBegin();

		success = _downloader.downloadFileToPath(
			getMediaInfo().getUrlByPictureType(_pictureType),
			getMediaInfo().getDownloadPath(_pictureType));

		if (null != _listener)
			_listener.TaskFinish(this);
	}
}
